#include<bits/stdc++.h>
#define MSET(x,y) memset(x,y,sizeof(x))
#define all(a) a.begin(), a.end()
#define F first
#define S second
#define MP make_pair
#define PB push_back
#define SZ size()
#define M 100005
#define ll long long
#define ld long double
#define INF 1e18
#define NINF -1e18
#define endl "\n"
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
using namespace std;
ll MOD = 1000000007;
string yes = "YES\n";
string no = "NO\n";
void solve(ll t) {
ll n;
cin >> n;
vector<ll> a(n);
for(auto &it : a) cin >> it;
ll s, f;
cin >> s >> f;
ll sum = 0,mx=0,timeat1=s-1;
for(ll i=0;i<(f-s);i++) sum += a[i];
mx=sum;
for(ll i=1;i<n;i++) {
sum = sum - a[i-1] + a[(i + (f-s) - 1)%n];
// cout << i << " " << sum << endl;
if(sum >= mx) {
if(sum == mx) timeat1 = min(timeat1, (n + s-i-1)%n);
else timeat1 = (n+s-i-1)%n;
mx=sum;
// cout << i << " " << timeat1 << endl;
}
}
cout << timeat1+1<< endl;
}
int32_t main() {
fastio;
#ifndef ONLINE_JUDGE
freopen("i.txt", "r", stdin);
freopen("o.txt", "w", stdout);
#endif
ll t=1;
// cin>>t;
for(ll i=1;i<=t;i++) {
solve(i);
}
}
74. Search a 2D Matrix | 71. Simplify Path |
62. Unique Paths | 50. Pow(x, n) |
43. Multiply Strings | 34. Find First and Last Position of Element in Sorted Array |
33. Search in Rotated Sorted Array | 17. Letter Combinations of a Phone Number |
5. Longest Palindromic Substring | 3. Longest Substring Without Repeating Characters |
1312. Minimum Insertion Steps to Make a String Palindrome | 1092. Shortest Common Supersequence |
1044. Longest Duplicate Substring | 1032. Stream of Characters |
987. Vertical Order Traversal of a Binary Tree | 952. Largest Component Size by Common Factor |
212. Word Search II | 174. Dungeon Game |
127. Word Ladder | 123. Best Time to Buy and Sell Stock III |
85. Maximal Rectangle | 84. Largest Rectangle in Histogram |
60. Permutation Sequence | 42. Trapping Rain Water |
32. Longest Valid Parentheses | Cutting a material |
Bubble Sort | Number of triangles |
AND path in a binary tree | Factorial equations |